home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWRgnShp.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.5 KB  |  151 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWRgnShp.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWRGNSHP_H
  11. #define FWRGNSHP_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. // ----- Foundation Includes -----
  18.  
  19. #ifndef FWDEBUG_H
  20. #include "FWDebug.h"
  21. #endif
  22.  
  23. // ----- OpenDoc Includes -----
  24.  
  25. #ifndef SOM_ODShape_xh
  26. #include <Shape.xh>
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class FW_CGraphicContext;
  34.  
  35. //========================================================================================
  36. //    class FW_CRegionShape
  37. //========================================================================================
  38.  
  39. class FW_CRegionShape : public FW_CShape
  40. {
  41. public:
  42.     FW_DECLARE_CLASS
  43.     FW_DECLARE_AUTO(FW_CRegionShape)
  44.  
  45. //----------------------------------------------------------------------------------------
  46. //    Constructors/Destructors
  47. //
  48. public:
  49.     FW_CRegionShape(ODShape* odShape,
  50.                     FW_ERenderVerbs renderVerb,
  51.                     const FW_CInk& ink = FW_kNormalInk,
  52.                     const FW_CStyle& style = FW_kNormalStyle);
  53.     
  54.     FW_CRegionShape(const FW_CRegionShape& other);
  55.     FW_CRegionShape(FW_CReadableStream& stream);
  56.     
  57.     virtual ~ FW_CRegionShape();
  58.  
  59. //----------------------------------------------------------------------------------------
  60. //    Operators
  61. //
  62. public:
  63.     FW_CRegionShape& operator=(const FW_CRegionShape& other);
  64.     
  65. //----------------------------------------------------------------------------------------
  66. //    Inherited API
  67. //
  68. public:
  69.     // ----- Hit Testing -----
  70.     virtual FW_Boolean     HitTest(FW_CGraphicContext& gc,
  71.                                     const FW_CPoint& test,
  72.                                     FW_Fixed tolerance) const;
  73.  
  74.     // ----- Copying -----
  75.     virtual FW_CShape*        Copy() const;
  76.     
  77.     // ----- Transform -----
  78.     virtual void            Transform(Environment* ev, ODTransform* odTransform);
  79.     virtual void            InverseTransform(Environment* ev, ODTransform* odTransform);
  80.  
  81.     virtual void            MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
  82.     virtual void            MoveShapeTo(FW_Fixed x, FW_Fixed y);
  83.  
  84.     virtual void            Inset(FW_Fixed h, FW_Fixed v);
  85.  
  86.     // ----- Geometry -----
  87.     virtual void             GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
  88.  
  89.     // ----- Anchor Point -----
  90.     virtual FW_CPoint        GetAnchorPoint() const;
  91.     
  92.     // ----- Rendering -----
  93.     virtual void            Render(FW_CGraphicContext& gc) const;
  94.     
  95.     // ----- Flatten -----
  96.     virtual void            Flatten(FW_CWritableStream& stream) const;
  97.     
  98. //----------------------------------------------------------------------------------------
  99. //    New API
  100. //
  101. public:    
  102.     // ----- Rendering -----
  103.     static void            RenderRegion(FW_CGraphicContext& gc,
  104.                                         ODShape* odShape,
  105.                                         FW_ERenderVerbs renderVerb,
  106.                                         const FW_CInk& ink = FW_kNormalInk,
  107.                                         const FW_CStyle& style = FW_kNormalStyle);
  108.     
  109.     // ----- Archiving -----
  110.     static void*             Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  111.  
  112.     // ----- Getter/Setters -----
  113.     void                    GetGeometry(ODShape* odShape) const;        // returns a copy
  114.     void                    SetGeometry(ODShape* odShape);            // use a copy        
  115.     
  116.     ODShape*                GetODShape() const;                        // return fODShape                        
  117.     void                    AdoptODShape(ODShape* newODShape);        // Doesn't use a copy
  118.     ODShape*                OrphanODShape();                            //
  119.  
  120. private:
  121.     void                    DisposeODShape(Environment* ev);
  122.     
  123. //----------------------------------------------------------------------------------------
  124. //    Data Members
  125. //
  126. private:
  127.     ODShape                *fODShape;        
  128. };
  129.  
  130. //========================================================================================
  131. //    inlines
  132. //========================================================================================
  133.  
  134. //----------------------------------------------------------------------------------------
  135. //    FW_CRegionShape::GetODShape
  136. //----------------------------------------------------------------------------------------
  137. inline ODShape* FW_CRegionShape::GetODShape() const
  138. {
  139.     return fODShape;
  140. }
  141.  
  142. //----------------------------------------------------------------------------------------
  143. //    FW_CRegionShape::GetGeometry
  144. //----------------------------------------------------------------------------------------
  145. inline void FW_CRegionShape::GetGeometry(ODShape* odShape) const
  146. {
  147.     odShape->CopyFrom(somGetGlobalEnvironment(), fODShape);    // [HLX] for now
  148. }
  149.  
  150. #endif
  151.